function G(id){
   return document.getElementById(id);	
}
function ck(){
   if(G('yourname').value == ''){
	alert("姓名不能为空！");
	G('yourname').focus();
	return false;
   }
	 if(G('company').value == ''){
	alert("企业名称不能为空！");
	G('company').focus();
	return false;
   }
   if(G('message').value == ''){
	alert("内容不能为空！");
	G('message').focus();
	return false;
   }
}


function tabObject(titleSel, contentSel) {
    this.titleList = $(titleSel).children();
    this.contentList = $(contentSel).children();
    this.tabLength = 0;
    this.actTitleCss = "";
    this.defaultIndex = 0;
    this.curIndex = 0;
    this.hideSpeed = "fast";
    this.showSpeed = "normal";

    this.showContent = function(event) {
        var index = event.data.index;
        var tabObj = event.data.tabObj;
        if (index > tabObj.contentList.length - 1 || index == tabObj.curIndex) return;
        if (tabObj.actTitleCss != "") {
            tabObj.titleList.eq(tabObj.curIndex).removeClass(tabObj.actTitleCss);
            tabObj.titleList.eq(index).addClass(tabObj.actTitleCss);
        }
        tabObj.contentList.eq(tabObj.curIndex).hide(); //tabObj.contentList.eq(tabObj.curIndex).hide(tabObj.hideSpeed);
        tabObj.contentList.eq(index).show(); //tabObj.contentList.eq(index).show(tabObj.showSpeed);
        tabObj.curIndex = index;
    }

    this.initTab = function() {
        this.tabLength = Math.min(this.titleList.length, this.contentList.length);
        if (this.tabLength == 0) return;
        this.defaultIndex = Math.min(this.defaultIndex, this.tabLength);

        if (this.actTitleCss != "") this.titleList.eq(this.defaultIndex).addClass(this.actTitleCss);
        for (i = 0; i < this.contentList.length; i++) {
            if (i != this.defaultIndex) this.contentList.eq(i).hide();
        }
        this.contentList.eq(this.defaultIndex).show();
        this.curIndex = this.defaultIndex;

        for (i = 0; i < this.titleList.length; i++) {
            this.titleList.eq(i).bind("mouseover", { tabObj:this, index: i }, this.showContent);
        }
    };
}
